77200e5db27ec812f076b9e94fd29819c444aabb,samples/iotfdeviceclient/src/com/ibm/iotf/sample/client/gateway/SampleRasPiGateway.java,SampleRasPiGateway,addDeviceType,#,136
Before Change
*/
private void addDeviceType() throws IoTFCReSTException {
try {
JsonObject response = this.apiClient.addDeviceType(DEVICE_TYPE, null, null, null);
System.out.println(response);
} catch(IoTFCReSTException e) {
System.out.println("HttpCode :" + e.getHttpCode() +" ErrorMessage :: "+ e.getMessage());
// Print if there is a partial response
System.out.println(e.getResponse());
}
}
After Change
return;
}
} catch(IoTFCReSTException e) {
if (e.getHttpCode() == 404) {
apiClient.addDeviceType(deviceType, deviceType, null, null);
} else {
System.err.println("ERROR: unable to add manually device type " + e.getMessage());
e.printStackTrace();
}
}
}